package com.ssy.lingxi.order.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 交易流程规则的支付环节配置
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-24
 */
@Entity
@Table(schema = "public", name = "ord_trade_process_payment", indexes = {@Index(name = "ord_trade_process_payment_process_id_idx", columnList = "trade_process_id"), @Index(name = "ord_trade_process_payment_batch_no_idx", columnList = "batchNo")})
public class OrderTradeProcessPaymentDO implements Serializable {
    private static final long serialVersionUID = -6402627047188504767L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_trade_process_payment_seq")
    @SequenceGenerator(sequenceName = "ord_trade_process_payment_seq", name = "ord_trade_process_payment_seq", allocationSize = 1)
    private Long id;

    /**
     * 多对一双向关联交易流程规则
     */
    @JsonBackReference
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "trade_process_id")
    private OrderTradeProcessDO process;

    /**
     * 支付批次
     */
    private Integer serialNo;

    /**
     * 支付次数，顺序+1
     */
    @Column
    private Integer batchNo;

    /**
     * 支付环节
     */
    @Column(columnDefinition = "varchar(30)")
    private String payNode;

    /**
     * 支付比例
     */
    @Column(columnDefinition = "numeric(8,4)")
    private BigDecimal payRate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public OrderTradeProcessDO getProcess() {
        return process;
    }

    public void setProcess(OrderTradeProcessDO process) {
        this.process = process;
    }

    public Integer getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(Integer serialNo) {
        this.serialNo = serialNo;
    }

    public Integer getBatchNo() {
        return batchNo;
    }

    public void setBatchNo(Integer batchNo) {
        this.batchNo = batchNo;
    }

    public String getPayNode() {
        return payNode;
    }

    public void setPayNode(String payNode) {
        this.payNode = payNode;
    }

    public BigDecimal getPayRate() {
        return payRate;
    }

    public void setPayRate(BigDecimal payRate) {
        this.payRate = payRate;
    }
}
